import request from '@/utils/axios-req'
const SERVERURL = import.meta.env.VITE_APP_BASE_MIAN_URL
// const SERVERURL = "http://localhost:8000"
// 转换文件列表
export const getConvertList = ({page, size}) => {
  return request({
    url: `${SERVERURL}/convert/list?skip=${page}&limit=${size}`,
    reqLoading: false,
    method: 'get'
  })
}

// 转换文件详情
export const getConvertDetail = (id) => {
  return request({
    url: `${SERVERURL}/convert/list/${id}`,
    reqLoading: false,
    method: 'get'
  })
}

// 转换文件下载
export const downloadConvertFile = (id) => {
  return request({
    url: `${SERVERURL}/convert/list/${id}/download`,
    method: 'get'
  })
}

// STL to OBJ
export const convertSTLToOBJ = (file) => {
  return request({
    url: `${SERVERURL}/convert/stltoobj`,
    reqLoading: false,
    method: 'post',
    data: file
  })
}

// STL to PLY
export const convertSTLToPLY = (file) => {
  return request({
    url: `${SERVERURL}/convert/stltoply`,
    reqLoading: false,
    method: 'post',
    data: file
  })
}

// OBJ to STL
export const convertOBJToSTL = (file) => {
  return request({
    url: `${SERVERURL}/convert/objtostl`,
    reqLoading: false,
    method: 'post',
    data: file
  })
}

// OBJ to PLY
export const convertOBJToPLY = (file) => {
  return request({
    url: `${SERVERURL}/convert/objtoply`,
    reqLoading: false,
    method: 'post',
    data: file
  })
}

// PLY to STL
export const convertPLYToSTL = (file) => {
  return request({
    url: `${SERVERURL}/convert/plytostl`,
    reqLoading: false,
    method: 'post',
    data: file
  })
}

// PLY to OBJ
export const convertPLYToOBJ = (file) => {
  return request({
    url: `${SERVERURL}/convert/plytostl`,
    reqLoading: false,
    method: 'post',
    data: file
  })
}


// ### 转换文件列表
// GET http://127.0.0.1:8000/convert/list
// Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJqYXkzMjIyMSIsImV4cCI6MTcxNTE3ODkwNn0.FmV0fYETtkASA6XfTwy2FvBFYq8knfh3c52LFVr7sdg

// ### 转换文件详情
// GET http://127.0.0.1:8000/convert/list/1
// Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJqYXkzMjIyMSIsImV4cCI6MTcxNTE3ODkwNn0.FmV0fYETtkASA6XfTwy2FvBFYq8knfh3c52LFVr7sdg

// ### 转换文件下载
// GET http://127.0.0.1:8000/convert/list/1/download
// Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJqYXkzMjIyMSIsImV4cCI6MTcxNTE3ODkwNn0.FmV0fYETtkASA6XfTwy2FvBFYq8knfh3c52LFVr7sdg

// ### STL to OBJ
// POST http://127.0.0.1:8000/convert/stltoobj
// Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJqYXkzMjIyMSIsImV4cCI6MTcxNTE3ODkwNn0.FmV0fYETtkASA6XfTwy2FvBFYq8knfh3c52LFVr7sdg 
// Content-Type: multipart/form-data; boundary=WebAppBoundary

// --WebAppBoundary
// Content-Disposition: form-data; name="file"; filename="up_model.stl"
// Content-Type: application/octet-stream

// < stl_data/up_model.stl
// --WebAppBoundary--

// ### STL to PLY
// POST http://127.0.0.1:8000/convert/stltoply
// Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJqYXkzMjIyMSIsImV4cCI6MTcxNTE3ODkwNn0.FmV0fYETtkASA6XfTwy2FvBFYq8knfh3c52LFVr7sdg
// Content-Type: multipart/form-data; boundary=WebAppBoundary

// --WebAppBoundary
// Content-Disposition: form-data; name="file"; filename="up_model.stl"
// Content-Type: application/octet-stream

// < stl_data/up_model.stl
// --WebAppBoundary--

// ### OBJ to STL
// POST http://127.0.0.1:8000/convert/objtostl
// Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJqYXkzMjIyMSIsImV4cCI6MTcxNTE3ODkwNn0.FmV0fYETtkASA6XfTwy2FvBFYq8knfh3c52LFVr7sdg
// Content-Type: multipart/form-data; boundary=WebAppBoundary

// --WebAppBoundary
// Content-Disposition: form-data; name="file"; filename="down_model.obj"
// Content-Type: application/octet-stream

// < stl_data/down_model.obj
// --WebAppBoundary--
// ### OBJ to PLY
// POST http://127.0.0.1:8000/convert/objtoply
// Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJqYXkzMjIyMSIsImV4cCI6MTcxNTE3ODkwNn0.FmV0fYETtkASA6XfTwy2FvBFYq8knfh3c52LFVr7sdg
// Content-Type: multipart/form-data; boundary=WebAppBoundary

// --WebAppBoundary
// Content-Disposition: form-data; name="file"; filename="down_model.obj"
// Content-Type: application/octet-stream

// < stl_data/down_model.obj
// --WebAppBoundary--

// ### 
// POST http://127.0.0.1:8000/convert/plytostl
// Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJqYXkzMjIyMSIsImV4cCI6MTcxNTE3ODkwNn0.FmV0fYETtkASA6XfTwy2FvBFYq8knfh3c52LFVr7sdg
// Content-Type: multipart/form-data; boundary=WebAppBoundary

// --WebAppBoundary
// Content-Disposition: form-data; name="file"; filename="up_bridge.ply"
// Content-Type: application/octet-stream

// < stl_data/up_bridge.ply
// --WebAppBoundary--

// ### 
// POST http://127.0.0.1:8000/convert/plytoobj
// Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJqYXkzMjIyMSIsImV4cCI6MTcxNTE4MTE1Mn0.QYoQI7wdEMrQp3rFwyRxY66fAHAnkGdEz7E_7-OgJdc
// Content-Type: multipart/form-data; boundary=WebAppBoundary

// --WebAppBoundary
// Content-Disposition: form-data; name="file"; filename="up_bridge.ply"
// Content-Type: application/octet-stream

// < stl_data/up_bridge.ply
// --WebAppBoundary--